$(function(){
	/*初始化表格*/
	$('#user').datagrid({
		title:"用户管理",
		iconCls:'icon-edit',
		striped:true,
		border: true,
		collapsible:false,//是否可折叠的  
		fitColumns: true,
		loadMsg:"数据正在加载,请稍候...",
		rownumbers:true,
		singleSelect:false,
		selectOnCheck: true,
		checkOnSelect: true,
        url:'data/user.json', 
        pagination:true,
        columns:[[   
                  {field:'ck',checkbox:true},
                  {field:'name',title:'登录名',width:$(this).width() * 0.1},   
                  {field:'nikename',title:'名字',width:$(this).width() * 0.1}, 
                  {field:'workid',title:'工号',width:$(this).width() * 0.2}, 
                  {field:'state',title:'用户状态',width:$(this).width() * 0.1},
                  {field:'note',title:'备注',width:$(this).width() * 0.5}
              ]],
       
       /* frozenColumns:[[  
                        {field:'ck',checkbox:true}  
        ]],  */
        toolbar: [{  
            text: '添加',  
            iconCls: 'icon-add',  
            handler: function() {  
            	showAdd("#dlg","新增用户","#userForm","index.json");
            }  
        }, '-', {  
            text: '修改',  
            iconCls: 'icon-edit',  
            handler: function() {  
            	showEdit('#user','#dlg','修改用户','#userForm','data/index.json');
            }  
        }, '-',{  
            text: '删除',  
            iconCls: 'icon-remove',  
            handler: function(){  
                del('#user','data/index.json');  
            }  
        }/*, '-',{  
            text: '查看',  
            iconCls: 'icon-nav-punishment',  
            handler: function(){  
                view('#user','#viewplan','查看计划');  
            }  
        }*/]
    });  
});